-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make namespace configurable for anywhere resources #177
Conversation
I might be missing it in all these files, but we should make sure that we prevent We've got the validation in the upgrade preflight check of immutable fields, but we'll want to add it to the immutable fields in the |
Since we are retrieving objects based on namespace, would change the namespace count as creating a new object instead, which would need to be blocked for the create rather than making that specific field immutable? |
pkg/api/v1alpha1/object_meta.go
Outdated
@@ -6,5 +6,6 @@ package v1alpha1 | |||
// and https://github.com/kubernetes-sigs/cluster-api/blob/bf790fc2a53614ff5d3405c83c0de0dd3303bb1f/api/v1alpha2/common_types.go#L67-L128 | |||
// as needed. | |||
type ObjectMeta struct { | |||
Name string `json:"name,omitempty"` | |||
Name string `json:"name,omitempty"` | |||
Namespace string `json:"namespace,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to output the namespace as part of the generate command, so this isn't required right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall, but let's add a e2e test for this that specifies a different namespace from default and tests flux and upgrade.
@@ -20,6 +20,12 @@ func ValidateImmutableFields(ctx context.Context, k ValidationsKubectlClient, cl | |||
return fmt.Errorf("cluster name is immutable") | |||
} | |||
|
|||
if prevSpec.Namespace != spec.Namespace { | |||
if !(prevSpec.Namespace == "default" && spec.Namespace == "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to have this same check for GitOps and OIDC? Or is this not the case because it would fail in validations earlier anyways? If that's the case, we technically don't need the checks above for VSphere if this check here covers it for all the config anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true. These cases are covered in earlier validations. I removed the unnecessary checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: feyyyyylo, taneyland, vivek-koppuru The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issue #, if available:
Description of changes:
This PR creates a namespace field in the clusterconfig for all "anywhere.eks.amazonaws.com" resources. This namespace is configurable, so the user can specify the name of the namespace to store these resources. If no namespace is specified, it will behave as it does currently & use the "default" namespace.
These changes were tested with the following cases (all cases had external etcd configured):
Create/Delete with Flux enabled
Upgrade with Flux enabled
Create/Delete without Flux
Upgrade without Flux
EKS-A controller still behaves as expected
Not specifying namespace still defaults to the "default" namespace
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.